"""
开放商户 - 商户定点清算修改相关模型
"""

from typing import Dict, Any, List
from jlpay.model.base import OrgBaseReq, BaseResponse
from jlpay.utils.annotation_utils import Encrypt


@Encrypt  # 标记整个类需要加密处理，对应Java代码中的@DataCrypto(encrypt = true)
class FixedWithdrawModifyRequest(OrgBaseReq):
    """商户定点清算修改请求"""
    
    API_URL = "/open/merch/access/fixed-withdraw/modify"
    
    def __init__(self):
        """初始化商户定点清算修改请求"""
        super().__init__()
        self.apply_id = None  # 申请单id
        self.merch_no = None  # 商户号
        self.operate_type = None  # 设置方式，0-取消1-设置
        self.withdraw_time_list = None  # 定点清算时间列表
    
    def set_apply_id(self, apply_id):
        """
        设置申请单id
        
        Args:
            apply_id: 申请单id
            
        Returns:
            FixedWithdrawModifyRequest实例
        """
        self.apply_id = apply_id
        return self
    
    def set_merch_no(self, merch_no):
        """
        设置商户号
        
        Args:
            merch_no: 商户号
            
        Returns:
            FixedWithdrawModifyRequest实例
        """
        self.merch_no = merch_no
        return self
    
    def set_operate_type(self, operate_type):
        """
        设置设置方式
        
        Args:
            operate_type: 设置方式，0-取消1-设置
            
        Returns:
            FixedWithdrawModifyRequest实例
        """
        self.operate_type = operate_type
        return self
    
    def set_withdraw_time_list(self, withdraw_time_list):
        """
        设置定点清算时间列表
        
        Args:
            withdraw_time_list: 定点清算时间列表
            
        Returns:
            FixedWithdrawModifyRequest实例
        """
        self.withdraw_time_list = withdraw_time_list
        return self
    
    def to_dict(self) -> Dict[str, Any]:
        """
        将请求对象转换为字典
        
        Returns:
            字典对象
        """
        data = super().to_dict()
        data['apply_id'] = self.apply_id
        data['merch_no'] = self.merch_no
        data['operate_type'] = self.operate_type
        data['withdraw_time_list'] = self.withdraw_time_list
        return data


class FixedWithdrawModifyResponse(BaseResponse):
    """商户定点清算修改响应参数"""
    
    def __init__(self, response_dict=None):
        """
        初始化商户定点清算修改响应
        
        Args:
            response_dict: 响应字典
        """
        super().__init__(response_dict)
        self.merch_no = None  # 商户号
        self.apply_id = None  # 业务申请编号
        
        if response_dict:
            self.merch_no = response_dict.get('merch_no')
            self.apply_id = response_dict.get('apply_id')
    
    def to_dict(self) -> Dict[str, Any]:
        """
        将响应对象转换为字典
        
        Returns:
            字典对象
        """
        data = super().to_dict()
        data['merch_no'] = self.merch_no
        data['apply_id'] = self.apply_id
        return data 